package xyz.labmem.main.modular.common.pojo

import io.swagger.annotations.ApiModelProperty
import xyz.labmem.base.core.base.BasePage
import xyz.labmem.base.core.base.BaseVerify
import javax.validation.Valid
import javax.validation.constraints.NotBlank

/**
 * @Author lty
 * @Date 2022/2/15 16:22
 */
class FormPage : BasePage() {

    @Valid
    @ApiModelProperty(value = "表单查询集合", required = false)
    var query =  ArrayList<QueryMap>()

}

class QueryMap {

    @ApiModelProperty(value = "查询字段")
    @NotBlank(message = "查询字段不能为空", groups = [BaseVerify.page::class])
    var field: String? = null

    @ApiModelProperty(value = "字段值")
    var value: String? = null

    @ApiModelProperty(value = "查询类型(默认模糊查询)", example = "LIKE")
    var type: QueryType = QueryType.LIKE

}

enum class QueryType {
    LIKE,
    EQ, //=
    LT, //<
    GT, //>
    DESC,
    ASC
}